﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using BLL;
using Common;

namespace JKDD.Patient
{
    public partial class PatientIndex : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.lbl_shownoanswer.Text = "";
                txt_mess_doc.Text = ""; 
                //initialization();
            }
        }


        void initialization()
        {
            int patientID = 1;
            DataTable messList = new DataTable();
            messList = PatientBLL.getMessList(patientID);
            if (messList == null)
            {
                //没有历史咨询

                this.txt_mess_doc.Text = "暂时没有回复";
                this.lbl_shownoanswer.Text = "暂时没有咨询";
                return;
            }

            //取结果的第一项加载留言版上，其余的以标题形式显示在列表中
            int answerornot = 0;
            try
            {
                answerornot = Convert.ToInt32(messList.Rows[0]["NANSWER"].ToString());
            }
            catch (Exception ex)
            {
                throw ExceptionHelper.handle(1,"NANSWER数据转换出错", ex);
            }
            if (answerornot == 0)
            { 
                //还没回复，作相关提示
                this.txt_mess_doc.Text = "暂时没有回复，请稍候再查看";
                return;

            }
            else if (answerornot == 1)
            {
                //已经回复，绑定数据显示
                txt_mess_doc.Text = messList.Rows[0]["SANSWER_DOCT"].ToString();
                txt_ask.Text = messList.Rows[0]["SANSWER_DOCT"].ToString();
            }
            else
            { 
                //异常情况，很可能保存的时候忘记更新 nanswer的值
                return;
            }
        }

        protected void btn_OK_Click(object sender, EventArgs e)
        {

        }

        protected void btn_cancle_Click(object sender, EventArgs e)
        {

        }
    }
}
